#ifndef UTI_TRADESERIES_H_
#define UTI_TRADESERIES_H_
#pragma once
#include "sys_config.h"
#include "uti_memman.h"
#include "uti_trade.h"


typedef struct TradeSerInfo
{
	unsigned int sersize;
	void (*p)();


}TradeSerInfo;



class TradeSeries
{
public:
	TradeSeries(TradeSerInfo* pserinfo);

	~TradeSeries();

	void AddTrade(CThostFtdcTradeField* pOrder);

private:

	void NewTrade(CThostFtdcTradeField* pOrder);

	void OldTrade(CThostFtdcTradeField* pOrder);



public:
	TradeData* m_ptradecur;//point to last bar of series, this bar may not complete(could be control by value of BarData.isend)

	unsigned int m_tradeindex;// if m_pcur is avaliable, its value is >=0. ;
	// used to find other avaliable BarDate before m_pcur, for example used to caculate MA(5)

	TradeSerInfo m_tradeserinfo;

private:

	MemMan<TradeData>* m_pmemman; // memory management class of BarSeries. used to store Bar Series data. last bar is m_pobarcur. 


};



#endif